<?php
use Illuminate\Support\Facades\Route;

Route::get('permission-denied','PagesController@permissionDenied')->name('permission-denied');
Route::get('/','TopicController@index')->name('root');


// 用户身份验证相关的路由
Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
Route::post('login', 'Auth\LoginController@login');
Route::post('logout', 'Auth\LoginController@logout')->name('logout');

// 用户注册相关路由
Route::get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
Route::post('register', 'Auth\RegisterController@register');

// 密码重置相关路由
Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update');

// 再次确认密码（重要操作前提示）
Route::get('password/confirm', 'Auth\ConfirmPasswordController@showConfirmForm')->name('password.confirm');
Route::post('password/confirm', 'Auth\ConfirmPasswordController@confirm');

// Email 认证相关路由
Route::get('email/verify', 'Auth\VerificationController@show')->name('verification.notice');
Route::get('email/verify/{id}/{hash}', 'Auth\VerificationController@verify')->name('verification.verify');
Route::post('email/resend', 'Auth\VerificationController@resend')->name('verification.resend');

//用户资源路由
Route::resource('users','UsersController',['only'=>['show','update','edit']]);

//图片上传
Route::post('upload_image','TopicController@uploadImage')->name('topic.upload_image');
//显示帖子详情
Route::get('topics/{topic}/{slug?}','TopicController@show')->name('topics.show');
//帖子的资源路由
Route::resource('topics','TopicController')->only(['index','create','store','edit','update','destroy']);


//分类资源路由
Route::resource('categories','CategoriesController')->only(['show']);

//回复资源路由
Route::resource('replies','ReplyController')->only(['store','destroy']);

//通知
Route::resource('notifications','NotificationsController')->only('index');


